package com.fenghongzhang.kotlin5.day03

fun main(){
    //?.
    //let.
    //?:
    //!!
    doSome(null)
    val stringLen = getStringLen(null)
    println(stringLen)


    var test = "home"
    if (test != null){//注释1
        printTextUp(test)
    }
}

fun printTextUp(text:String?){
    println(text?.toUpperCase()) //注释2
}

fun doSome(user:User?){
//    user?.eat()
//    user?.drink()
//    user?.drink1()
//    user?.drink2()
    user?.let {
        it.eat()
        it.drink()
        it.drink1()
    }
}

fun getStringLen(s:String?):Int{
    var s1 = s?.length ?: 0
    return s1
}

fun getStringLen1(s:String)  = s?.length ?: 0

